package gridreport.test;

import java.util.ArrayList;
import java.util.List;

//import gridreport.Group;
//import gridreport._Group;
//import gridreport._User;

public class ReportGroup {
    private String group;
    private String dir;
    private List<ReportItem> items = new ArrayList<ReportItem>();

    public String getGroup() {
        return group;
    }

    public void setGroup(String group) {
        this.group = group;
    }
    
    public String getDir() {
        return dir;
    }

    public void setDir(String dir) {
        this.dir = dir;
    }
    
    public List<ReportItem> getItems() {
        return items;
    }

    //public void setUsers(List<_ReportItem> users) {
    //    this.users = users;
    //}

    public void addUser(ReportItem item) {
    	items.add(item);
    }
    
	public ReportGroup() {
	}

}

/*
class _Group {
    private Long       id;
    private String     name;
    private List<_User> users = new ArrayList<_User>();

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public List<_User> getUsers() {
        return users;
    }

    public void setUsers(List<_User> users) {
        this.users = users;
    }

    public void addUser(_User user) {
        users.add(user);
    }
}

class _User {
    private Long   id;
    private String name;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}

		//<<JSON test
		//Encode
		_Group group = new _Group();
		group.setId(0L);
		group.setName("admin");

		_User guestUser = new _User();
		guestUser.setId(2L);
		guestUser.setName("guest");

		_User rootUser = new _User();
		rootUser.setId(3L);
		rootUser.setName("root");

		group.addUser(guestUser);
		group.addUser(rootUser);

		String jsonString = JSON.toJSONString(group);
		System.out.println(jsonString);

		//Decode
		String jsonText = "{\"id\":0,\"name\":\"admin\",\"users\":[{\"id\":2,\"name\":\"guest\"},{\"id\":3,\"name\":\"root\"}]}";
		Group group2 = JSON.parseObject(jsonString, Group.class);
		String jsonString2 = JSON.toJSONString(group);
		System.out.println(jsonString2);
		//JSON test>>
		
*/